package com.felix.controller;

import com.felix.service.DeptService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;

/**
 * @program: dubboDemoParent
 * @ClassName DeptController
 * @description:
 * @author: yaoguipei
 * @create: 2022-01-20 13:21
 * @Version 1.0
 **/
@Controller
public class DeptController {
    @Autowired
    private DeptService deptService;

    @GetMapping("/dept")
    public String showDept(Model model){
        System.out.println("controller in");
        model.addAttribute("list" , deptService.findAll());
        return "dept";
    }

    @GetMapping("/showEmp")
    public String showEmp(Integer did , Model model)
    {
        model.addAttribute("list" , deptService.findEmpByDeptId(did));
        return "showEmp";
    }
}
